#ifndef _WX_UNIX_EXECUTE_H
#define _WX_UNIX_EXECUTE_H

#include "wx/unix/pipe.h"

class wxProcess;
class wxStreamTempInputBuffer;

struct wxEndProcessData {
  int pid,                // pid of the process
      tag;                // port dependent value
  wxProcess *process;     // if !NULL: notified on process termination
  int  exitcode;          // the exit code
};

struct wxExecuteData {
  wxExecuteData() {
    flags =
      pid = 0;
    process = NULL;
    #if wxUSE_STREAMS
    bufOut =
      bufErr = NULL;
    #endif // wxUSE_STREAMS
  }

  // wxExecute() flags
  int flags;

  // the pid of the child process
  int pid;

  // the associated process object or NULL
  wxProcess *process;

  // pipe used for end process detection
  wxPipe pipeEndProcDetect;

  #if wxUSE_STREAMS
  // the input buffer bufOut is connected to stdout, this is why it is
  // called bufOut and not bufIn
  wxStreamTempInputBuffer *bufOut,
                          *bufErr;
  #endif // wxUSE_STREAMS
};

extern void wxHandleProcessTermination( wxEndProcessData *proc_data );
extern int wxAddProcessCallback( wxEndProcessData *proc_data, int fd );

#endif // _WX_UNIX_EXECUTE_H
